package controllers

import (
	"fmt"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/astaxie/beego"
)

type CallController struct {
	beego.Controller
}

func (this *CallController ) Get() {
	client, err := sdk.NewClientWithAccessKey("cn-hangzhou", "LTAI1Ovf2QY8moxB", "Wy6JcDy0oD7jxE6zovA1SGHtB7M1Vr")
	if err != nil {
		panic(err)
	}

	request := requests.NewCommonRequest()
	request.Method = "POST"
	request.Scheme = "https" // https | http
	request.Domain = "dyplsapi.aliyuncs.com"
	request.Version = "2017-05-25"
	request.ApiName = "BindAxn"
	request.QueryParams["RegionId"] = "cn-hangzhou"
	request.QueryParams["Expiration"] = "2019-09-05 12:00:00"
	request.QueryParams["PhoneNoA"] = "17858968657"

	//request.QueryParams
	response, err := client.ProcessCommonRequest(request)
	if err != nil {
		panic(err)
	}
	fmt.Print(response.GetHttpContentString())

	this.Ctx.WriteString(response.GetHttpContentString())
}